﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using SilverlightHVP.ViewModel;

namespace SilverlightHVP.View
{
   public partial class SmoothStreamPlayerView : UserControl
   {
      public Control CorePlayer { get; private set; }

      public SmoothStreamPlayerView()
      {
         InitializeComponent();
         Loaded += new RoutedEventHandler( SmoothStreamPlayerView_Loaded );
      }

      
      void SmoothStreamPlayerView_Loaded( object sender, RoutedEventArgs e )
      {
         /*
         if ( System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() == true )
         {
            var binding = new System.Windows.Data.Binding();
            binding.Mode = System.Windows.Data.BindingMode.OneWay;
            binding.Source = this.DataContext;


            var ssmp = new Microsoft.SilverlightMediaFramework.Player.CoreSmoothStreamingMediaElement();
            binding.Path = new PropertyPath( "URI" );
            ssmp.SetBinding( ssmp.SmoothStreamingSource, binding );
            binding.Path = new PropertyPath( "Offset" );
            binding.Mode = System.Windows.Data.BindingMode.TwoWay;
            ssmp.SetBinding( ssmp.Position, binding );
            ssmp.AutoPlay = true;
            CorePlayer = ssmp;
         }
         else
         {
            var media = new MediaElement();
            media.Source = new Uri( @"c:\temp\wildlife.wmv", UriKind.Absolute );
            media.AutoPlay = true;
            CorePlayer = media;
         }
         */
      }
            

        
      public void SetViewModel( PlayerViewModel playerViewModel )
      {
         this.DataContext = playerViewModel;
      }


   }
}
